Ext.define('AmpleHarvest.objects.topicmodel.cChartBar',
{
	extend		: 'Ext.chart.Chart',
	animate		: true,
	flex		: 1,
//	store		: Ext.create('Ext.data.JsonStore', {
//	    fields: ['word', 'probability'],
//	    data: []
//	}),
	insetPadding: 100,
	axes: [{
        type: 'Numeric',
        position: 'bottom',
        fields: ['probability'],
        label: {
        	// TODO: for some reason the bottom axis is not taking into account the largest number in the series
            renderer: Ext.util.Format.numberRenderer('0.00')
        },
        title: 'Model Frequency',
        grid: true,
        minimum: 0
    }, {
        type: 'Category',
        position: 'left',
        fields: ['word'],
        title: 'Model Values'
    }],
    series: [{
        type: 'bar',
        axis: 'bottom',
        highlight: true,
        tips: {
          trackMouse: true,
          width: 200,
          height: 28,
          renderer: function(storeItem, item) {
            this.setTitle(storeItem.get('word') + ': ' + storeItem.get('probability'));
          }
        },
        label: {
          display: 'insideEnd',
            field: 'probability',
            renderer: Ext.util.Format.numberRenderer('00.00'),
            orientation: 'horizontal',
            color: '#333',
            'text-anchor': 'middle'
        },
        xField: 'word',
        yField: 'probability'
    }],
//    tbar: [{
//	    text: 'Save Chart',
//	    handler: function() {
//	        Ext.MessageBox.confirm('Confirm Download', 'Would you like to download the chart as an image?', function(choice){
//	            if(choice == 'yes'){
//	                chart.save({
//	                    type: 'image/png'
//	                });
//	            }
//	        });
//	    }
//	}, {
//	    text: 'Reload Data',
//	    handler: function() {
//	        store1.loadData(generateData());
//	    }
//	}, {
//	    enableToggle: true,
//	    pressed: true,
//	    text: 'Animate',
//	    toggleHandler: function(btn, pressed) {
//	        var chart = Ext.getCmp('chartCmp');
//	        chart.animate = pressed ? { easing: 'ease', duration: 500 } : false;
//	    }
//	}],
    
    initComponent	: function()
    {    	
    	this.callParent();
    }
});